/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

.tooltip-creator {
  width: fit-content;
  height: fit-content;
  display: flex;
}

.tooltip-creator-inline {
  display: inline;
  text-decoration: underline;
}

.tooltip {
  position: absolute;
  pointer-events: initial;
  background-color: var(--tooltip-background);
  color: var(--foreground);
  border: 1px solid var(--tooltip-border);
  padding: var(--pad);
  z-index: 1000;
  opacity: 0;
  animation: fadein 0.1s forwards linear;
  height: 100%;
}
@keyframes fadein {
  0% {
    opacity: 0%;
  }
  100% {
    opacity: 100%;
  }
}

.tooltip-arrow {
  --arrow-height: calc(var(--pad) - 4px);
  --arrow-half-width: calc(var(--arrow-height) / 2);
  position: absolute;
}

.tooltip-arrow::after {
  content: ' ';
  position: absolute;
  width: var(--arrow-height);
  height: var(--arrow-height);
  background-color: var(--tooltip-background);
  border-right: 1px solid var(--tooltip-border);
  border-bottom: 1px solid var(--tooltip-border);
}

.tooltip.simple-text-tooltip {
  max-width: 250px;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: unset;
}

.tooltip-arrow-bottom::after {
  transform: rotate(225deg);
}
.tooltip-arrow-top::after {
  transform: rotate(45deg);
}
.tooltip-arrow-left::after {
  transform: rotate(315deg);
}
.tooltip-arrow-right::after {
  transform: rotate(135deg);
}

.tooltip-arrow-bottom {
  left: calc(50% - var(--arrow-half-width));
  top: calc(-1px - var(--arrow-half-width));
}
.tooltip-arrow-top {
  left: calc(50% - var(--arrow-half-width));
  bottom: calc(var(--arrow-half-width));
}
.tooltip-arrow-left {
  right: calc(var(--arrow-half-width));
  top: calc(50% - var(--arrow-half-width));
}
.tooltip-arrow-right {
  left: calc(-1px - var(--arrow-half-width));
  top: calc(50% - var(--arrow-half-width));
}
